import request from '@/utils/request'


///////投票题目表

export function getQuestions(params) {
  return request({
    url: '/polls/question/',
    method: 'GET',
    params
  })
}


export function addQuestion(data) {
  return request({
    url: '/polls/question/',
    method: 'POST',
    data
  })
}

export function updateQuestion(data) {
  return request({
    url: `/polls/question/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delQuestion(id) {
  return request({
    url: `/polls/question/${id}/`,
    method: 'DELETE',
  })
}

export function delQuestions(data) {
  return request({
    url: '/polls/question/batch_delete/',
    method: 'DELETE',
    data
  })
}

export function delChoices(data) {
  return request({
    url: `/polls/choice/batch_delete/`,
    method: 'DELETE',
    data
  })
}

// 投票详情
export function getVoteDetails(params) {
  return request({
    url: '/polls/vote_detail/',
    method: 'GET',
    params
  })
}


export function addVoteDetail(data) {
  return request({
    url: '/polls/vote_detail/',
    method: 'POST',
    data
  })
}

export function updateVoteDetail(data) {
  return request({
    url: `/polls/vote_detail/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delVoteDetail(id) {
  return request({
    url: `/polls/vote_detail/${id}/`,
    method: 'DELETE',
  })
}

export function delVoteDetails(data) {
  return request({
    url: '/polls/vote_detail/batch_delete/',
    method: 'DELETE',
    data
  })
}


export function delChoiceImage(id) {
  return request({
    url: `/polls/choice_image/${id}/`,
    method: 'DELETE',
  })
}
